home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 705 < prev    next >
Text File  |  1996-08-06  |  1KB  |  30 lines

  1. Newsgroups: comp.std.c
  2. Path: news.uunet.ca!wildcan!sq!msb
  3. From: msb@sq.com (Mark Brader)
  4. Subject: Re: Is it legal to add 0 to NULL? What about NULL < NULL?
  5. Message-ID: <1996Apr8.053026.7583@sq.com>
  6. Summary: No, but the wrong question was asked
  7. Organization: SoftQuad Inc., Toronto, Canada
  8. References: <ff1d.smail.smayo@tiac.net> <828905693snz@genesis.demon.co.uk>
  9. Date: Mon, 8 Apr 1996 05:30:26 GMT
  10.  
  11. > > Thing *a = A;
  12. > > Thing *fence = a + S;
  13. > > for (; a < fence; ++a)
  14. > >     /* use a */;
  15. > > 
  16. > > but in my case, if S happens to be 0, a will start out NULL.
  17.  
  18. Er, no.  If S happens to be 0, but A yields a valid Thing * pointer,
  19. then a and fence will both start out equal to that pointer value.
  20.  
  21. If A is a null pointer or null pointer constant, *then* a will start
  22. out as a null pointer, and the undefined behavior described by Lawrence
  23. Kirby in the Referenced article will occur.
  24. -- 
  25. Mark Brader, msb@sq.com, SoftQuad Inc., Toronto
  26.         "I'm a little worried about the bug-eater," she said.  "We're embedded
  27.         in bugs, have you noticed?"             -- Niven, "The Integral Trees"
  28.  
  29. My text in this article is in the public domain.
  30.